package org.minos.edit.controller
{
	import org.aswing.JOptionPane;
	import org.minos.edit.EditFacate;
	import org.minos.edit.Main;
	import org.minos.edit.model.vo.DialogVO;
	import org.minos.edit.model.vo.ItemVO;
	import org.minos.edit.view.components.SceneTable;
	import org.minos.edit.view.EditMediator;
	import org.minos.edit.view.TableMediator;
	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.patterns.command.SimpleCommand;
	
	/**
	 * ...
	 * @author Minos
	 */
	public class RemoveSceneCommand extends SimpleCommand
	{
		
		override public function execute( notification : INotification ) : void
		{
			super.execute( notification );
			
			var table : SceneTable = facade.retrieveMediator( TableMediator.NAME ).getViewComponent() as SceneTable;
			var vo : ItemVO = table.getSelectedVO();
			if ( vo == null )
				return;
			var dialog : DialogVO = new DialogVO( "提示" , "确认删除场景？" , JOptionPane.YES | JOptionPane.NO );
			dialog.callback = function( result : int ) : void
			{
				if ( result == JOptionPane.YES )
					table.removeScene( vo );
			}
			sendNotification( EditFacate.SHOW_DIALOG , dialog );
		
		}
	
	}

}